
export default {
    state: {
        USERINFO: localStorage.getItem('userinfo') ? localStorage.getItem('userinfo') : '',
    },
    getters: {
        GetUserInfo: function (state) {
            if (!state.USERINFO) {
                state.USERINFO = JSON.parse(localStorage.getItem("userinfo"))
            }
            return state.USERINFO
        }
    },
    mutations: {
        // 设置用户信息
        SetUserInfo(state, value) {
            console.log(value)
            state.USERINFO = value
            localStorage.setItem("userinfo", JSON.stringify(value))
        }
    }
}